import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import '../../widget/my_image.dart';
class HomeMenus extends StatefulWidget {
  final List<dynamic> homeMenus;
  HomeMenus({this.homeMenus});
  @override
  _HomeMenusState createState() => _HomeMenusState();
}

class _HomeMenusState extends State<HomeMenus> {
  @override
  Widget build(BuildContext context) {
    return Container(
      height:310.h,
      color: Colors.white,
      child: GridView.count(
      scrollDirection: Axis.vertical,
//      padding: const EdgeInsets.all(20.0),
      primary: true,
      physics: NeverScrollableScrollPhysics(),
      childAspectRatio:1.2,
      mainAxisSpacing: 0.0,              // 竖向间距
      crossAxisCount: 4,                  // 横向 Item 的个数
      crossAxisSpacing:0,             // 横向间距
      children: widget.homeMenus.map((value){
        return new Container(
          color: Colors.white,
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            crossAxisAlignment: CrossAxisAlignment.center,
            children: <Widget>[
              Container(
                width:50,
                height:50,
                child: CircleAvatar(
//                  backgroundColor:Colors.red,
                  child: MyImage(
                      imgSrc:'${value['pic']}'
                  )
                ),
              ),
              SizedBox(height:5),
              Text('${value['name']}',style: TextStyle(
                  color:Colors.black87,
                  fontSize: 12
              ),)
            ],
          ),
        );
      }).toList(),
    ),
    );
  }
}

